import requests

s = requests.Session()

host = 'http://localhost'
# 登陆
url = host + '/smeoa/index.php?m=login&a=check_login'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
# datas = {'emp_no':'admin', 'password':'admin'}
datas = 'emp_no=admin&password=admin'
# r = s.post(url, data=datas)
r = s.request('POST', url, data=datas, headers=headers)
if '退出' in r.text:
    print('登陆成功')
else:
    print('登陆失败')

# # #新增公告
datas={'name':'1','folder_name':'title','opmode':'add'}
r = s.post(host + '/smeoa/index.php?m=notice_folder&a=save',data=datas)
if '新增成功' in r.text:
    print('新增公告成功')
else:
    print('新增公告失败')
